#include <iostream.h>
#include <conio.h>
#include <stdio.h>

#define MAX 100
void nhap(int a[], int &n)
{
	cout <<"nhap so n: "; cin >> n;
	for (int i=0;i<n;i++)
	{
		cout <<"phan tu thu " << i <<" : ";cin >>a[i];
	}
}
void xuat (int a[],int n)
{
	cout <<"day so la: ";
	for (int i=0;i<n;i++)
		cout <<a[i] << "  ";
		cout << endl;
}
void tongle(int a[],int n)
{
	int tong=0;
	for (int i=0;i<n;i++)
		if (a[i]%2!=0)
			tong=tong+a[i];
			cout << endl <<"tong cac so le la: " <<tong << endl;
}
void chiahetcho5(int a[],int n)
{
	int i;
	cout <<"cac so chia het cho 5: ";
	for (i=0;i<n;i++)
	{
		if (a[i]%5==0)
			cout << a[i];
	}
}
void giam(int a[], int n)
{
	int i,j,tam;
	for (i=0;i<n-1;i++)
		for (j=i+1;j<n;j++)
			if(a[i]<a[j])
		{
			tam=a[i];
			a[i]=a[j];
			a[j]=tam;
		}
}
void ham_5_3(int a[],int n)
{
	int i;
	cout <<"cac so chia het cho 5 va khong chia het cho 3: ";
	for (i=0;i<n;i++)
	{
		if (a[i]%5==0 && a[i]%3!=0)
			cout << a[i];
	}
}
int timkiem(int a[],int n,int i)
{
	int vt=0;
	while (vt<n && a[vt]!=i)
		vt++;
	if (vt<n)
		return vt;
	return -1;
}
void tim(int  a[], int n)
{
	int i,kq;
	cout <<"nhap gia tri can tim: ";
	cin >> i;
	kq=timkiem(a,n,i);
	if(kq==-1)
		cout <<"khong tim thay " << i <<" trong mang";
	else
		cout <<"tim thay " << i <<" trong mang";

}
void main ()
{
	int a[MAX],n;
	nhap(a,n);
	xuat(a,n);
   tim(a,n);
	tongle(a,n);
	chiahetcho5(a,n);
	giam(a,n);
	cout <<endl <<"thu tu giam dan" <<" " ;
	xuat (a,n);
   ham_5_3(a,n);


}
